<include file="Public/head" />
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.parse.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/_examples/editor_api.js"></script>
</head>
<include file="Public/common_header" />
<div class="mian">
    <include file="Public/sidebar"  menu="clcwht.clcwxxgl" />

    <div class="mianR">
        <h3 class="yonghu">修改消息</h3>
        <form id="annForm">
            <div class="gonggao">
                <ul>
                    <li class="clearfix"><span>标题：</span><input type="text" name="title" value="{$message.title}" id="title" placeholder="请填写标题"/></li>
                    <li class="clearfix"><span>收信人：</span><input type="text" name="receive_ids" id="receive_ids" placeholder="请输入收信人的用户ID，若不填，则为发送给所有人（用户ID间用英文半角逗号隔开，选填）" value="{$message.receive_ids}"/></li>
                    <li class="clearfix"><span>消息参数：</span><input type="text" name="params" id="params" placeholder="请填写消息参数（选填）" value='{$message.params}'/></li>
                    <li class="clearfix"><span>消息内容:</span><span style="width:400px; text-align: left">注意事项:仅支持左对齐；支持空行、换行。</span></li>
                    <li class="clearfix">
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <textarea width="20px" height="30px" name="content" id="content" >{$message.content}</textarea>
                    </li>
                </ul>
            </div>

            <div class="yongBtn">
                <input type="hidden" value="{$message.id}" id="msg_id" name="msg_id">
                <input type="button" value="确定" class="queding" />
                <input name="reset" onclick="history.go(-1);" type="reset" class="quxiao" value="取消" />
            </div>
            <div class="clear"></div>
        </form>
    </div>
    <script type="text/javascript">
        $('.quxiao').click(function(){
            window.location.href = "/ClcwMessage/index";
        })
        $('.queding').click(function () {
            var msg_id = $('#msg_id').val();
            var title = $("#title").val();
            var receive_ids = $.trim($("#receive_ids").val());
            if (receive_ids != '') {
                var reg = /^(\d+,?)+$/;
                if (!reg.test(receive_ids)) {
                    shibai_alert("抱歉，收信人填写不正确");
                    return false;
                }
            }
            var params = $("#params").val();
            var content = $("#content").val();
            $.post('/ClcwMessage/editMessageData', {
                'msg_id': msg_id,
                'title': title,
                'receive_ids': receive_ids,
                'params': params,
                'content': content
            }, function (data) {
                if (data.code != 200) {
                    shibai_alert(data.msg, 800);
                    return false;
                }
                btn_alert(data.msg, 1000, function () {
                    window.location.href = "/ClcwMessage/index";
                });
            }, 'json');
        });;
    </script>
    </body>
    </html>
